//== GAIA ============================================================================

//== BEGINNING OF CODE ===============================================================

#include "sagittarius/core/SagittariusCore.h"
#include "sagittarius/patterns/hashtable_th.h"
#include "sagittarius/io/io.h"

#include <stdio.h>
#include <malloc.h>
#include <assert.h>

int main(int argc, char* argv[])
{
    int copy=1;
    hashtable64* ht;
    char* strchurchill = "We shall defend our island, whatever the cost may be";
    char* strjefferson = "We hold these truths to be self-evident";
    char* strlincoln =   "Four score and seven years ago";
    char* strjfk =       "Ask not what your country can do for you";
    char* strfdr =       "You have nothing to fear but fear itself";
    char* strbush =      "Bring 'em on!";
    
    ht = ht64_rehash(NULL, 2, 2);
    
    ht64_insert(ht, strjefferson, sizeof(strlincoln), (copy)?sizeof(strlincoln):0);
    ht64_insert(ht, strlincoln,   sizeof(strlincoln), (copy)?sizeof(strlincoln):0);
    ht64_insert(ht, strjfk,       sizeof(strjfk),     (copy)?sizeof(strlincoln):0);
    ht64_insert(ht, strfdr,       sizeof(strfdr),     (copy)?sizeof(strlincoln):0);
    ht64_insert(ht, strbush,      sizeof(strbush),    (copy)?sizeof(strlincoln):0);
    
    ht64_dumpstate(2, ht);
    
    printf("Hash table has strchurchill: %d\n", ht64_check(ht, strchurchill, sizeof(strchurchill)));
    printf("Hash table has strjefferson: %d\n", ht64_check(ht, strjefferson, sizeof(strjefferson)));
    printf("Hash table has strlincoln: %d\n",   ht64_check(ht, strlincoln,   sizeof(strlincoln)));
    printf("Hash table has strjfk: %d\n",       ht64_check(ht, strjfk,       sizeof(strjfk)));
    printf("Hash table has strfdr: %d\n",       ht64_check(ht, strfdr,       sizeof(strfdr)));
    printf("Hash table has strbush: %d\n",      ht64_check(ht, strbush,      sizeof(strbush)));
    
    ht64_destroy(ht);
    
    return 0;
}
